<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<meta name="format-detection" content="telephone=no, address=no, email=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="misapplication-tap-highlight" content="no" />
		<meta name="HandheldFriendly" content="true" />
		<title>个人中心安全</title>
		<link rel="stylesheet" href="../../css/mui.min.css" type="text/css" charset="utf-8" />
		<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />

	</head>

	<body>
		<header class="mui-bar mui-bar-nav mui-header">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">安全</h1>
		</header>
		<div class="mui-content">
			<form class="mui-input-group">
				<div class="mui-input-row" style="background:none;">
					<label>电话</label>
					<input type="text" class="mui-input-clear" id="mobile" value="" disabled="true">
				</div>
				<div style="margin-bottom:0.14rem;overflow: hidden;">
					<div class="mui-input-row" style="float:left;width:61.40625%;margin-bottom:0px;">
						<label style="width:45.5%">验证码</label>
						<input type="text" class="mui-input-clear" id="vcode" placeholder="验证码" style="width:54.5%">
					</div>
					<button type="button" class="mui-btn sendvcode" id="sendMsg">获取验证码</button>

				</div>

				<div class="mui-input-row">
					<label>新密码</label>
					<input type="password" class="mui-input-password" id="newpassword" placeholder="请填写新密码">
				</div>
				<div class="mui-input-row">
					<label>确认密码</label>
					<input type="password" class="mui-input-password" id="confirmpassword" placeholder="请确认密码">
				</div>
				<div class="mui-button-row">
					<button type="button" class="mui-btn mui-btn-primary mui-btn-full" onclick="editPass()" style="height:44px;background:#f1c40f;color:#fff;border-color:#f1c40f">确认</button>
				</div>

			</form>
		</div>

	</body>
	<script src="../../js/resize.js"></script>
	<script src="../../js/ajaxFun.js"></script>
	<script src="../../js/mui.min.js"></script>
	<script src="../../js/app.js"></script>
	<!--<script type="text/javascript" src="js/update.js"></script>-->
	<script>
		var userInfo = JSON.parse(localStorage.getItem('$users') || '[]');
		var vcode;
		
		(function($, doc) {
			$.plusReady(function() {
				plus.nativeUI.closeWaiting();
				document.getElementById("mobile").value = userInfo.mobile;
				app.sendVcode('02');/*修改密码*/
			})
		}(mui, document))

	
		function editPass() {
			var newpassword = document.getElementById("newpassword").value;
			var confirmpassword = document.getElementById("confirmpassword").value;
			if(!newpassword || !confirmpassword) {
				plus.nativeUI.alert('密码不能为空');
				return false;
			} else{
				if(newpassword != confirmpassword ) {
					plus.nativeUI.alert('两次输入密码不一致！'); 
					return false;
				}else{
					var passResult=regPassword(newpassword);
					if(passResult.status=='error'){
						plus.nativeUI.alert('密码为至少包含字母，数字，符号中两种的8到32个字！且首字母不能为符号'); 
						return false;
					}
					vcode = document.getElementById("vcode").value;
					if(!vcode) {
						plus.nativeUI.alert('请填写验证码！'); 
						return false; 
					} else {
						ajaxFun.postFun(baseUrl + 'traderInfoController/editPassword.do', {
							password: newpassword,
							verificationCode: vcode
						}, '', function() {
							localStorage.clear();
							openWindow('../../login.html', 'login', {});
						})
					}
				}
			}
		}
	</script>

</html>